{% from "common/macros.html" import static %}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{% block title %}{% endblock %}-CMS管理系统</title>
    {% include "common/heads.html" %}
    <script src="{{ url_for("static",filename="common/zlajax.js") }}"></script>
    <script src="{{ url_for("static",filename="common/zlparam.js") }}"></script>
    <link rel="stylesheet" href="{{ static("cms/css/css_base.css") }}">
    <script src="{{ static("cms/js/cms_base.js") }}"></script>
    {% block head %}{% endblock %}
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">知了课堂论坛CMS管理系统</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
                <li><a href="{{ url_for("cms.profile") }}">{{ g.cms_user.username }}<span></span></a></li>
                <li><a href="{{ url_for("cms.logout") }}">注销</a></li>
            </ul>
            <form class="navbar-form navbar-right">
                <input type="text" class="form-control" placeholder="查找...">
            </form>
        </div>
    </div>
</nav>

<div class="container-fluid">
    <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
            <ul class="nav-sidebar">
                <li class="unfold"><a href="{{ url_for("cms.index") }}">首页</a></li>
                <li class="profile-li">
                    <a href="#">个人中心<span></span></a>
                    <ul class="subnav">
                        <li><a href="{{ url_for("cms.profile") }}">个人信息</a></li>
                        <li><a href="{{ url_for("cms.resetpwd") }}">修改密码</a></li>
                        <li><a href="{{ url_for("cms.resetemail") }}">修改邮箱</a></li>
                    </ul>
                </li>
                {% set cms_user = g.cms_user %}

                <li class="nav-group banner-manage"><a href="{{ url_for("cms.banner") }}">轮播图管理</a></li>
                {% if cms_user.has_permission(CMSPermission.POSTER) %}
                    <li class="nav-group post-manage"><a href="{{ url_for("cms.posts") }}">帖子管理</a></li>
                {% endif %}
                {% if cms_user.has_permission(CMSPermission.COMMENTER) %}
                    <li class="comments-manage"><a href="{{ url_for("cms.comments") }}">评论管理</a></li>
                {% endif %}

                {% if cms_user.has_permission(CMSPermission.BOAEDER) %}
                    <li class="board-manage"><a href="{{ url_for("cms.boards") }}">板块管理</a></li>
                {% endif %}

                {% if cms_user.has_permission(CMSPermission.FRONTUSER) %}
                    <li class="nav-group user-manage"><a href="{{ url_for("cms.fusers") }}">前台用户管理</a></li>
                    <li class="role-manage"><a href="{{ url_for("cms.roles") }}">组管理</a></li>
                {% endif %}

                {% if cms_user.has_permission(CMSPermission.CMSUSER ) %}
                    <li class="nav-group cmsuser-manage"><a href="{{ url_for("cms.cmsuser_manage") }}">CMS用户管理</a></li>
                {% endif %}

                {% if cms_user.is_developer %}
                    <li class="cmsrole-manage"><a href="{{ url_for("cms.cmsrole_manage") }}">CMS组管理</a></li>
                {% endif %}

            </ul>
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <h1>{% block page_title %}{% endblock %}</h1>
            <div class="main_content">
                {% block main_context %}{% endblock %}
            </div>
        </div>
    </div>
</div>
</body>
</html>